<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>工作室管理 - 运输管理</title>
<link rel="stylesheet" type="text/css" href="/static/style/common.css">
<link rel="stylesheet" type="text/css" href="/static/style/freightindex.css">
</head>

<body>
<!-- 运输管理通用头部 -->
<jsp:include page="../common/settingheader.jsp" flush="true"></jsp:include>
<!-- 运输管理通用头部 end -->


<!-- 运费模板 -->
<div class="wrapper">
	<jsp:include page="../common/settingmenu.jsp" flush="true"></jsp:include>
	<div class="shopmanagerightcontent">
		<div class="shopmanageright">
			<div class="addnewtemp">
				<a href="/freight/toAdd">+ 新增运费模板</a>
			</div>
			<div class="freighttemp">
				<c:forEach items="${pager.items}" var="temp">
					<div class="freighttemplist">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td colspan="6">
									<table width="100%" border="0" cellspacing="0" cellpadding="0" class="freighttop">
										<tr>
											<td width="40%" class="freighttempname">${temp.name}</td>
											<td width="60%" align="right" class="editfreighttemp">最后编辑时间：<fmt:formatDate value="${temp.updateTime}" pattern="yyyy/MM/dd HH:mm"/> <a href="javascript:;" class="copytemp" tempId="${temp.id}">复制模板</a> <a href="/freight/toUpdate/${temp.id}">修改</a> <a href="javascript:;" class="deltemp" tempId="${temp.id}">删除</a></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td width="15%">运送方式</td>
								<td width="37%">运送到</td>
								<td width="12%">首件（个）</td>
								<td width="12%">运费（元）</td>
								<td width="12%">续件（个）</td>
								<td width="12%">运费（元）</td>
							</tr>
							<c:forEach items="${temp.freightTempSubs}" var="sub">
								<tr>
									<td>${sub.deliveryMethod.name}</td>
									<td>全国</td>
									<td>${sub.inRange}</td>
									<td><fmt:formatNumber value="${sub.inRangePrice/100}" pattern="0.00"/></td>
									<td>${sub.outRangeWeight}</td>
									<td><fmt:formatNumber value="${sub.outRangePrice/100}" pattern="0.00"/></td>
								</tr>
								<c:forEach items="${sub.destinations}" var="des">
									<tr>
										<td>${sub.deliveryMethod.name}</td>
										<td>
											<c:forEach items="${des.areas}" var="area" varStatus="st">
												${area.areaName}
												<c:if test="${!st.last}">
													 /
												</c:if>
											</c:forEach>
										</td>
										<td>${des.inRange}</td>
										<td><fmt:formatNumber value="${des.inRangePrice/100}" pattern="0.00"/></td>
										<td>${des.outRangeWeight}</td>
										<td><fmt:formatNumber value="${des.outRangePrice/100}" pattern="0.00"/></td>
									</tr>
								</c:forEach>
							</c:forEach>
						</table>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="clear"></div>
		<div class="pagebox">
			<div class="line"></div>
			<div class="btnbox">
				<div class="prevbtn"><i></i></div>
				<div class="numbox">
					<c:if test="${pager.totalPage < 11}">
						<c:forEach var="temp" begin= "1" step= "1" end= "${pager.totalPage}">
							<div class="number_o">${temp}</div>
						</c:forEach>
					</c:if>
					<c:if test="${pager.totalPage > 10}">
						<c:forEach var="temp" begin= "1" step= "1" end= "8">
							<div class="number_o">${temp}</div>
						</c:forEach>
						<p>...</p>
						<div class="number_o">${pager.totalPage}</div>
					</c:if>
					<%--<div class="number_o">1</div>--%>
					<%--<div class="number_o act">2</div>--%>
					<%--<div class="number_o">3</div>--%>
					<%--<div class="number_o">4</div>--%>
					<%--<div class="number_o">5</div>--%>
					<%--<div class="number_o">6</div>--%>
					<%--<p>...</p>--%>
					<%--<div class="number_o">100</div>--%>
				</div>
				<div class="nextbtn"><i></i></div>
			</div>
		</div>
	</div>
</div>



<!-- 运输管理通用尾部 -->
<script src="/static/js/jquery-1.10.2.min.js"></script>
<script src="/static/js/common.js"></script>
<jsp:include page="../common/footer.jsp" flush="true"></jsp:include>
<!-- 运输管理通用尾部 end -->

<div class="overbg"></div>
<script src="/static/js/freightindex.js"></script>
<script>
$(function(){
	$('.number_o').each(function(){
		if('${pager.pageNo}' == $(this).text().toString()){
			$(this).addClass('act');
		}
		$(this).click(function(){
//			$('.number_o').removeClass('act');
//			$(this).addClass('act');
			window.location.href = '/freight/list/'+$(this).text();
		})
	});
	$('.prevbtn').click(function(){
		var pre = parseInt($('div.act').text())-1;
		var min = parseInt($('div.number_o:first').text());
		if(pre < min){
			pre = min;
		}
		window.location.href = '/freight/list/'+pre;
	});
	$('.nextbtn').click(function(){
		var next = parseInt($('div.act').text())+1;
		var max = parseInt($('div.number_o:last').text());
		if(next > max){
			next = max;
		}
		window.location.href = '/freight/list/'+next;
	});
});
</script>
</body>
</html>